package com.heima.article.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heima.article.mapper.ApArticleConfigMapper;
import com.heima.article.service.ApArticleConfigService;
import com.heima.model.article.pojos.ApArticleConfig;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * <p>
 * APP已发布文章配置表 服务实现类
 * </p>
 *
 * @author heima
 * @since 2021-08-06
 */
@Service
public class ApArticleConfigServiceImpl extends ServiceImpl<ApArticleConfigMapper, ApArticleConfig> implements ApArticleConfigService {

    @Override
    public void updateIsDown(Map<String, Object> msgMap) {
        Long articleId  = (Long) msgMap.get("id");
        Integer enable = (Integer) msgMap.get("enable");
        UpdateWrapper<ApArticleConfig> wrapper = new UpdateWrapper<>();
        wrapper.eq("article_id",articleId);
        wrapper.set("is_down",enable==1?0:1);
        update(wrapper);
    }
}
